﻿using System;
using System.Collections.Generic;
using System.Text;
using Graffiti.Core;
using DataBuddy;
using System.Data;

namespace GraffitiExtras.Plugins.RssExtender
{
    public class RssExtender : GraffitiEvent
    {
        #region EditableForm members

        public override string Name
        {
            get
            {
                return "RSS Extender";
            }
        }

        public override string Description
        {
            get
            {
                return "RSS Extender plug-in for Graffiti. By <a href=\"http://nayyeri.net\">" +
                    "Keyvan Nayyeri</a>.";
            }
        }

        public override bool IsEditable
        {
            get
            {
                return false;
            }
        }

        #endregion

        public override void Init(GraffitiApplication ga)
        {
            ga.RssItem += new RssPostEventHandler(ga_RssItem);
        }

        void ga_RssItem(System.Xml.XmlTextWriter writer, PostEventArgs e)
        {
            SiteSettings settings = SiteSettings.Get();
            writer.WriteElementString("author",
                string.Format("{0} <{1}>", settings.Title, settings.EmailFrom));
        }
    }
}
